Revision 8ced1aa08f9e1798b2b3fec41a0598ef79b477fe authored by Chris Webb on 26 June 2012, 15:06:42 UTC, committed by Junio C Hamano on 26 June 2012, 18:11:14 UTC
abe199808c (git checkout -b: allow switching out of an unborn branch)
introduced a bug demonstrated by

  git checkout --orphan foo
  git checkout --detach
  git symbolic-ref HEAD

which gives 'refs/heads/(null)'.

This happens because we strbuf_addf(&branch_ref, "refs/heads/%s",
opts->new_branch) when opts->new_branch can be NULL for --detach.

Catch and forbid this case, adding a test to t2017 to catch it in
future.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent abe1998
Raw File
send-pack.h
#ifndef SEND_PACK_H
#define SEND_PACK_H

struct send_pack_args {
	unsigned verbose:1,
		quiet:1,
		porcelain:1,
		progress:1,
		send_mirror:1,
		force_update:1,
		use_thin_pack:1,
		use_ofs_delta:1,
		dry_run:1,
		stateless_rpc:1;
};

int send_pack(struct send_pack_args *args,
	      int fd[], struct child_process *conn,
	      struct ref *remote_refs, struct extra_have_objects *extra_have);

#endif
back to top