Re: [PATCH 4/8] rev-parse: teach "git rev-parse --symbolic" to print the full ref name

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

 



Steffen Prohaska <prohaska@xxxxxx> writes:

> "git rev-parse --symbolic" used to return the ref name as it was
> specified on the command line. This is changed to returning the
> full matched ref name, i.e. "git rev-parse --symbolic master"
> now typically returns "refs/heads/master".

This is to expose "dwim_ref" logic, so it might be a good idea
to introduce a new option --dwim-ref for this purpose.

	git rev-parse --symbolic master^2

is designed to give "master^2" or fail if "master" is not a
merge.  Similarly, you would diagnose a failure if somebody asks
to show

	git rev-parse --dwim-ref master~4

instead of giving "refs/heads/master~4".

> +static void show_rev(int type, const unsigned char *sha1, const char *name, const char* real_name)
> @@ -131,7 +133,7 @@ static void show_default(void)
>  
>  		def = NULL;
>  		if (!get_sha1(s, sha1)) {
> -			show_rev(NORMAL, sha1, s);
> +			show_rev(NORMAL, sha1, s, 0);

A null pointer constant in git sources is spelled "NULL" not "0".

> @@ -213,6 +215,7 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
>  {
>  	int i, as_is = 0, verify = 0;
>  	unsigned char sha1[20];
> +	char* real_name = 0;

Pointer sign '*' in git sources go next to the name not the
type, as:

	char *real_name = NULL;
-
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]

  Powered by Linux