Re: [PATCH] git-config: handle --file option with relative pathname properly

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

 



Gerrit Pape schrieb:
@@ -189,7 +189,11 @@ int cmd_config(int argc, const char **argv, const char *prefix)
 		else if (!strcmp(argv[1], "--file") || !strcmp(argv[1], "-f")) {
 			if (argc < 3)
 				usage(git_config_set_usage);
-			setenv(CONFIG_ENVIRONMENT, argv[2], 1);
+			if (argv[2][0] == '/')

Please use is_absolute_path() here.

+				name = argv[2];
+			else
+				name = name ? prefix_filename(name, strlen(name), argv[2]) : argv[2];

Can't you avoid this ternary here? There's already an 'if' with the same 'else' branch.

+			setenv(CONFIG_ENVIRONMENT, name, 1);
 			argc--;
 			argv++;
 		}

-- Hannes

-
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