Re: [PATCH] git-branch: deleting remote branches in new layout

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Quy Tonthat <qtonthat@xxxxxxxxx> writes:

> Now that remote branches are in refs/remotes/, branch -D needs to know
> where to find them.
>
> Signed-off-by: Quy Tonthat <qtonthat@xxxxxxxxx>

I recognize that giving end users a way to remove a "remote
tracking branch" might be a worthy goal ("update-ref -d" _could_
be used, but "branch -D" feels more natural).

> +	char ** s;
> +	static char * branches_dir[] = {"refs/heads", "refs/remotes", NULL};

But I do not like these two entries in branches_dir[].

(style: lose SP after '*' in these two lines, by the way).

If you had refs/heads/$X and refs/remotes/$X, I do not think
this code allows you to disambiguate.  You cannot remove
"remote" one without first removing the local one, can you?

> +		for (s = branches_dir; *s != NULL; s++) {
> +			name = xstrdup(mkpath("%s/%s", *s, argv[i]));
> +			if (resolve_ref(name, sha1, 1, NULL))
> +				break;
> +		}
> +		if (*s == NULL)
>  			die("Branch '%s' not found.", argv[i]);

(style: we seem to prefer "if (!*s)").

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]