Sync with 2.12.5
[gitweb.git] / builtin / grep.c
index 3ffb5b4e8176bbcd1ecf2e4ae2dc84aee968cd22..254c1c7849152884d9abd0b603f1c75f87e085b5 100644 (file)
@@ -1190,7 +1190,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                        break;
                }
 
-               if (get_sha1_with_context(arg, 0, oid.hash, &oc)) {
+               if (get_sha1_with_context(arg, GET_SHA1_RECORD_PATH,
+                                         oid.hash, &oc)) {
                        if (seen_dashdash)
                                die(_("unable to resolve revision: %s"), arg);
                        break;
@@ -1200,6 +1201,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
                if (!seen_dashdash)
                        verify_non_filename(prefix, arg);
                add_object_array_with_path(object, arg, &list, oc.mode, oc.path);
+               free(oc.path);
        }
 
        /*