[PATCH] builtin-clone: create remotes/origin/HEAD symref, if guessed
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
On Tue, 26 Feb 2008, Daniel Barkalow wrote:
> On Tue, 26 Feb 2008, Johan Herland wrote:
>
> > I've tried to test this by diffing a cloned repo against an
> > equivalent clone done by the old script. Below I pasted in a
> > few immediate fixes I found. With these fixes, the only
> > remaining diff between the clones is that
> > refs/remotes/origin/HEAD used to be a symbolic ref (with no
> > reflog), but is now a "regular" ref (with reflog).
>
> I think that's just a call to the wrong function (and a lack of
> very very explicit documentation).
This fixes it.
builtin-clone.c | 26 ++++++++++++++------------
1 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/builtin-clone.c b/builtin-clone.c
index 89ef665..bd09b0f 100644
--- a/builtin-clone.c
+++ b/builtin-clone.c
@@ -518,33 +518,35 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
git_config_set_multivar(key, value, "^$", 0);
}
+ if (head_points_at)
+ /* Local default branch */
+ create_symref("HEAD", head_points_at->name, NULL);
+
if (option_bare) {
- if (head_points_at) {
- /* Local default branch */
- create_symref("HEAD", head_points_at->name, NULL);
- }
junk_work_tree = NULL;
junk_git_dir = NULL;
return 0;
}
if (head_points_at) {
+ struct strbuf buf;
+
if (strrchr(head_points_at->name, '/'))
head = strrchr(head_points_at->name, '/') + 1;
else
head = head_points_at->name;
- /* Local default branch */
- create_symref("HEAD", head_points_at->name, NULL);