Merge branch 'jc/sha1-name-more'
Teaches the object name parser things like a "git describe" output is always a commit object, "A" in "git log A" must be a committish, and "A" and "B" in "git log A...B" both must be committish, etc., to prolong the lifetime of abbreviated object names. * jc/sha1-name-more: (27 commits) t1512: match the "other" object names t1512: ignore whitespaces in wc -l output rev-parse --disambiguate=<prefix> rev-parse: A and B in "rev-parse A..B" refer to committish reset: the command takes committish commit-tree: the command wants a tree and commits apply: --build-fake-ancestor expects blobs sha1_name.c: add support for disambiguating other types revision.c: the "log" family, except for "show", takes committish revision.c: allow handle_revision_arg() to take other flags sha1_name.c: introduce get_sha1_committish() sha1_name.c: teach lookup context to get_sha1_with_context() sha1_name.c: many short names can only be committish sha1_name.c: get_sha1_1() takes lookup flags sha1_name.c: get_describe_name() by definition groks only commits sha1_name.c: teach get_short_sha1() a commit-only option sha1_name.c: allow get_short_sha1() to take other flags get_sha1(): fix error status regression sha1_name.c: restructure disambiguation of short names sha1_name.c: correct misnamed "canonical" and "res" ...
This commit is contained in:
@ -276,7 +276,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
|
||||
* Otherwise, argv[i] could be either <rev> or <paths> and
|
||||
* has to be unambiguous.
|
||||
*/
|
||||
else if (!get_sha1(argv[i], sha1)) {
|
||||
else if (!get_sha1_committish(argv[i], sha1)) {
|
||||
/*
|
||||
* Ok, argv[i] looks like a rev; it should not
|
||||
* be a filename.
|
||||
@ -289,9 +289,15 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
|
||||
}
|
||||
}
|
||||
|
||||
if (get_sha1(rev, sha1))
|
||||
if (get_sha1_committish(rev, sha1))
|
||||
die(_("Failed to resolve '%s' as a valid ref."), rev);
|
||||
|
||||
/*
|
||||
* NOTE: As "git reset $treeish -- $path" should be usable on
|
||||
* any tree-ish, this is not strictly correct. We are not
|
||||
* moving the HEAD to any commit; we are merely resetting the
|
||||
* entries in the index to that of a treeish.
|
||||
*/
|
||||
commit = lookup_commit_reference(sha1);
|
||||
if (!commit)
|
||||
die(_("Could not parse object '%s'."), rev);
|
||||
|
||||
Reference in New Issue
Block a user