diff options
author | Junio C Hamano <gitster@pobox.com> | 2019-04-22 11:14:43 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-04-22 11:14:43 +0900 |
commit | e36adf712251a19bd2ada0016764d340dfcf2ba0 (patch) | |
tree | 0b58e0a8e315bb737fdcdb16cf8f30d262025f76 /sha1-name.c | |
parent | ffac537e6cbbf934b08745a378932722df287a53 (diff) | |
parent | 7906af0cb84c8e65656347909abd4e22b04d1c1e (diff) | |
download | git-e36adf712251a19bd2ada0016764d340dfcf2ba0.tar.gz |
Merge branch 'ps/stash-in-c'
"git stash" rewritten in C.
* ps/stash-in-c: (28 commits)
tests: add a special setup where stash.useBuiltin is off
stash: optionally use the scripted version again
stash: add back the original, scripted `git stash`
stash: convert `stash--helper.c` into `stash.c`
stash: replace all `write-tree` child processes with API calls
stash: optimize `get_untracked_files()` and `check_changes()`
stash: convert save to builtin
stash: make push -q quiet
stash: convert push to builtin
stash: convert create to builtin
stash: convert store to builtin
stash: convert show to builtin
stash: convert list to builtin
stash: convert pop to builtin
stash: convert branch to builtin
stash: convert drop and clear to builtin
stash: convert apply to builtin
stash: mention options in `show` synopsis
stash: add tests for `git stash show` config
stash: rename test cases to be more descriptive
...
Diffstat (limited to 'sha1-name.c')
-rw-r--r-- | sha1-name.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sha1-name.c b/sha1-name.c index cfe5c874b6..07c71a7567 100644 --- a/sha1-name.c +++ b/sha1-name.c @@ -1530,6 +1530,25 @@ int get_oid(const char *name, struct object_id *oid) return get_oid_with_context(the_repository, name, 0, oid, &unused); } +/* + * This returns a non-zero value if the string (built using printf + * format and the given arguments) is not a valid object. + */ +int get_oidf(struct object_id *oid, const char *fmt, ...) +{ + va_list ap; + int ret; + struct strbuf sb = STRBUF_INIT; + + va_start(ap, fmt); + strbuf_vaddf(&sb, fmt, ap); + va_end(ap); + + ret = get_oid(sb.buf, oid); + strbuf_release(&sb); + + return ret; +} /* * Many callers know that the user meant to name a commit-ish by |