1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 14:57:52 +01:00
git/builtin
Michael Haggerty 0e729c7ed5 update-ref: fix "verify" command with missing <oldvalue>
If "git update-ref --stdin" was given a "verify" command with no
"<newvalue>" at all (not even zeros), the code was mistakenly setting
have_old=0 (and leaving old_sha1 uninitialized). But this is
incorrect: this command is supposed to verify that the reference
doesn't exist. So in this case we really need old_sha1 to be set to
null_sha1 and have_old to be set to 1.

Moreover, since have_old was being set to zero, *no* check of the old
value was being done, so the new value of the reference was being set
unconditionally to the value in new_sha1. new_sha1, in turn, was set
to null_sha1 in the expectation that that was the old value and it
shouldn't be changed. But because the precondition was not being
checked, the result was that the reference was being deleted
unconditionally.

So, if <oldvalue> is missing, set have_old unconditionally and set
old_sha1 to null_sha1.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-11 11:56:53 -08:00
..
add.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
annotate.c annotate: use argv_array 2014-07-16 11:10:11 -07:00
apply.c Merge branch 'rs/more-uses-of-skip-prefix' 2014-10-14 10:50:07 -07:00
archive.c replace {pre,suf}fixcmp() with {starts,ends}_with() 2013-12-05 14:13:21 -08:00
bisect--helper.c Replace deprecated OPT_BOOLEAN by OPT_BOOL 2013-08-05 11:32:19 -07:00
blame.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
branch.c Merge branch 'rs/ref-transaction' 2014-10-21 13:28:10 -07:00
bundle.c
cat-file.c use skip_prefix() to avoid more magic numbers 2014-10-07 11:09:16 -07:00
check-attr.c Merge branch 'jc/check-attr-honor-working-tree' into maint 2014-03-18 14:03:03 -07:00
check-ignore.c Merge branch 'dw/check-ignore-sans-index' 2013-09-20 12:37:32 -07:00
check-mailmap.c builtin: add git-check-mailmap command 2013-07-13 10:19:37 -07:00
check-ref-format.c
checkout-index.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
checkout.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
clean.c Merge branch 'jn/parse-config-slot' 2014-10-20 12:23:48 -07:00
clone.c Merge branch 'eb/no-pthreads' 2014-10-24 14:59:10 -07:00
column.c replace {pre,suf}fixcmp() with {starts,ends}_with() 2013-12-05 14:13:21 -08:00
commit-tree.c commit_tree: take a pointer/len pair rather than a const strbuf 2014-06-12 10:29:41 -07:00
commit.c Merge branch 'rs/ref-transaction' 2014-10-21 13:28:10 -07:00
config.c Merge branch 'jn/parse-config-slot' 2014-10-20 12:23:48 -07:00
count-objects.c count-objects: use for_each_loose_file_in_objdir 2014-10-16 10:10:41 -07:00
credential.c
describe.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
diff-files.c convert read_cache_preload() to take struct pathspec 2013-07-15 10:56:08 -07:00
diff-index.c convert read_cache_preload() to take struct pathspec 2013-07-15 10:56:08 -07:00
diff-tree.c diff-tree: avoid lookup_unknown_object 2014-07-28 10:14:34 -07:00
diff.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
fast-export.c teach fast-export an --anonymize option 2014-08-27 10:42:16 -07:00
fetch-pack.c Merge branch 'nd/shallow-clone' 2014-01-17 12:21:20 -08:00
fetch.c Merge branch 'jk/fetch-reflog-df-conflict' 2014-11-06 10:52:32 -08:00
fmt-merge-msg.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
for-each-ref.c Merge branch 'rs/ref-transaction' 2014-10-21 13:28:10 -07:00
fsck.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
gc.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
get-tar-commit-id.c use skip_prefix() to avoid more magic numbers 2014-10-07 11:09:16 -07:00
grep.c make add_object_array_with_context interface more sane 2014-10-16 10:10:44 -07:00
hash-object.c hash-object: add --literally option 2014-09-11 14:23:51 -07:00
help.c doc: add 'everyday' to 'git help' 2014-10-10 16:02:26 -07:00
index-pack.c index-pack: fix compilation with NO_PTHREADS 2014-10-13 12:33:30 -07:00
init-db.c Merge branch 'rs/strbuf-getcwd' 2014-09-02 13:28:44 -07:00
interpret-trailers.c trailer: add interpret-trailers command 2014-10-13 13:55:27 -07:00
log.c Merge branch 'rs/ref-transaction' 2014-10-21 13:28:10 -07:00
ls-files.c grammofix in user-facing messages 2014-09-02 12:00:30 -07:00
ls-remote.c builtin/ls-remote.c: rearrange xcalloc arguments 2014-05-27 14:00:43 -07:00
ls-tree.c pathspec: rename match_pathspec_depth() to match_pathspec() 2014-02-24 14:37:14 -08:00
mailinfo.c mailinfo: work around -Wstring-plus-int warning 2014-09-22 13:46:43 -07:00
mailsplit.c mailsplit: remove unnecessary unlink(2) call 2014-10-07 10:49:57 -07:00
merge-base.c Merge branch 'bm/merge-base-octopus-dedup' into maint 2014-02-13 13:38:59 -08:00
merge-file.c Replace deprecated OPT_BOOLEAN by OPT_BOOL 2013-08-05 11:32:19 -07:00
merge-index.c Convert "struct cache_entry *" to "const ..." wherever possible 2013-07-09 09:12:48 -07:00
merge-ours.c
merge-recursive.c replace {pre,suf}fixcmp() with {starts,ends}_with() 2013-12-05 14:13:21 -08:00
merge-tree.c merge-tree: remove unused df_conflict arguments 2014-09-02 11:02:58 -07:00
merge.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
mktag.c
mktree.c builtin/mktree.c: use ALLOC_GROW() in append_to_tree() 2014-03-03 14:54:45 -08:00
mv.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
name-rev.c use xstrfmt to replace xmalloc + strcpy/strcat 2014-06-19 15:20:54 -07:00
notes.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
pack-objects.c Merge branch 'jk/prune-mtime' 2014-10-29 10:07:56 -07:00
pack-redundant.c
pack-refs.c
patch-id.c patch-id: make it stable against hunk reordering 2014-06-10 13:09:24 -07:00
prune-packed.c prune-packed: use for_each_loose_file_in_objdir 2014-10-16 10:10:40 -07:00
prune.c prune: keep objects reachable from recent objects 2014-10-16 10:10:42 -07:00
push.c push: heed user.signingkey for signed pushes 2014-10-24 10:50:05 -07:00
read-tree.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
receive-pack.c Merge branch 'jc/push-cert' 2014-10-31 11:49:55 -07:00
reflog.c Merge branch 'jk/prune-mtime' 2014-10-29 10:07:56 -07:00
remote-ext.c use skip_prefix() to avoid more magic numbers 2014-10-07 11:09:16 -07:00
remote-fd.c
remote.c remote rm/prune: print a message when writing packed-refs fails 2014-10-15 10:47:26 -07:00
repack.c repack: pack objects mentioned by the index 2014-10-19 15:07:07 -07:00
replace.c refs.c: pass the ref log message to _create/delete/update instead of _commit 2014-10-15 10:47:22 -07:00
rerere.c rerere: fix for merge.conflictstyle 2014-04-30 10:30:02 -07:00
reset.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
rev-list.c commit: record buffer length in cache 2014-06-13 12:09:38 -07:00
rev-parse.c refs: make rev-parse --quiet actually quiet 2014-09-19 10:46:15 -07:00
revert.c parse-options: multi-word argh should use dash to separate words 2014-03-24 10:43:34 -07:00
rm.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
send-pack.c Merge branch 'jc/push-cert' 2014-10-08 13:05:25 -07:00
shortlog.c replace {pre,suf}fixcmp() with {starts,ends}_with() 2013-12-05 14:13:21 -08:00
show-branch.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
show-ref.c replace {pre,suf}fixcmp() with {starts,ends}_with() 2013-12-05 14:13:21 -08:00
stripspace.c builtin/stripspace.c: fix broken indentation 2013-09-06 13:33:17 -07:00
symbolic-ref.c refs.c: change resolve_ref_unsafe reading argument to be a flags field 2014-10-15 10:47:24 -07:00
tag.c refs.c: pass the ref log message to _create/delete/update instead of _commit 2014-10-15 10:47:22 -07:00
unpack-file.c
unpack-objects.c fsck_object(): allow passing object data separately from the object itself 2014-09-10 13:54:21 -07:00
update-index.c lockfile.h: extract new header file for the functions in lockfile.c 2014-10-01 13:56:14 -07:00
update-ref.c update-ref: fix "verify" command with missing <oldvalue> 2014-12-11 11:56:53 -08:00
update-server-info.c
upload-archive.c replace {pre,suf}fixcmp() with {starts,ends}_with() 2013-12-05 14:13:21 -08:00
var.c
verify-commit.c verify-commit: scriptable commit signature verification 2014-06-23 15:50:31 -07:00
verify-pack.c run-command: introduce CHILD_PROCESS_INIT 2014-08-20 09:53:37 -07:00
verify-tag.c
write-tree.c