{"thread":{"id":"7052","subject":"[PATCH 0/2] git-branch: improve command line handling of --abbrev=","startedAt":"2007-03-03T00:31:15Z","lastAt":"2007-03-03T00:31:17Z","messageCount":3,"participants":["Julian Phillips"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"36143","messageId":"11728818772136-git-send-email-julian@quantumfyre.co.uk","threadId":"7052","inReplyTo":null,"subject":"[PATCH 0/2] git-branch: improve command line handling of --abbrev=","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-03-03T00:31:15Z","receivedAt":"2007-03-03T00:31:15Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"When playing with git-branch I discovered that it handled the --abbrev= option\ndifferently to other commands, which surprised me.\n\nThis update the parsing code in builtin_branch.c to be the same as\nsetup_revisions in revision.c, and documents the new --no-abbrev option.\n\n-- \nJulian\n"},{"id":"36145","messageId":"11728818771064-git-send-email-julian@quantumfyre.co.uk","threadId":"7052","inReplyTo":"11728818772136-git-send-email-julian@quantumfyre.co.uk","subject":"[PATCH 1/2] git-branch: improve abbreviation of sha1s in verbose mode","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-03-03T00:31:16Z","receivedAt":"2007-03-03T00:31:16Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"git-branch has an --abbrev= command line option, but it does\nno checking of the input.  Take the argument parsing code from\nsetup_revisions in revisions.c, and also the code for parsing\nthe --no-abbrev option.\n\nSigned-off-by: Julian Phillips <julian@quantumfyre.co.uk>\n---\n builtin-branch.c |   12 ++++++++++--\n 1 files changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex d0179b0..d371849 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -12,7 +12,7 @@\n #include \"builtin.h\"\n \n static const char builtin_branch_usage[] =\n-  \"git-branch [-r] (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>] | (-m | -M) [<oldbranch>] <newbranch> | [--color | --no-color] [-r | -a] [-v [--abbrev=<length>]]\";\n+  \"git-branch [-r] (-d | -D) <branchname> | [-l] [-f] <branchname> [<start-point>] | (-m | -M) [<oldbranch>] <newbranch> | [--color | --no-color] [-r | -a] [-v [--abbrev=<length> | --no-abbrev]]\";\n \n #define REF_UNKNOWN_TYPE    0x00\n #define REF_LOCAL_BRANCH    0x01\n@@ -446,8 +446,16 @@ int cmd_branch(int argc, const char **argv, const char *prefix)\n \t\t\treflog = 1;\n \t\t\tcontinue;\n \t\t}\n+\t\tif (!prefixcmp(arg, \"--no-abbrev\")) {\n+\t\t\tabbrev = 0;\n+\t\t\tcontinue;\n+\t\t}\n \t\tif (!prefixcmp(arg, \"--abbrev=\")) {\n-\t\t\tabbrev = atoi(arg+9);\n+\t\t\tabbrev = strtoul(arg + 9, NULL, 10);\n+\t\t\tif (abbrev < MINIMUM_ABBREV)\n+\t\t\t\tabbrev = MINIMUM_ABBREV;\n+\t\t\telse if (abbrev > 40)\n+\t\t\t\tabbrev = 40;\n \t\t\tcontinue;\n \t\t}\n \t\tif (!strcmp(arg, \"-v\")) {\n-- \n1.5.0.2\n"},{"id":"36144","messageId":"11728818773390-git-send-email-julian@quantumfyre.co.uk","threadId":"7052","inReplyTo":"11728818771064-git-send-email-julian@quantumfyre.co.uk","subject":"[PATCH 2/2] git-branch: document new --no-abbrev option","fromName":"Julian Phillips","fromEmail":"julian@quantumfyre.co.uk","sentAt":"2007-03-03T00:31:17Z","receivedAt":"2007-03-03T00:31:17Z","isPatch":true,"sender":{"key":"julian@quantumfyre.co.uk","avatar":"https://avatars.githubusercontent.com/u/948888?v=4"},"body":"Add the new --no-abbrev option to the man page for the git-branch command.\n\nSigned-off-by: Julian Phillips <julian@quantumfyre.co.uk>\n---\n Documentation/git-branch.txt |    6 +++++-\n 1 files changed, 5 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-branch.txt b/Documentation/git-branch.txt\nindex aa1fdd4..3ea3b80 100644\n--- a/Documentation/git-branch.txt\n+++ b/Documentation/git-branch.txt\n@@ -8,7 +8,8 @@ git-branch - List, create, or delete branches\n SYNOPSIS\n --------\n [verse]\n-'git-branch' [--color | --no-color] [-r | -a] [-v [--abbrev=<length>]]\n+'git-branch' [--color | --no-color] [-r | -a]\n+\t   [-v [--abbrev=<length> | --no-abbrev]]\n 'git-branch' [-l] [-f] <branchname> [<start-point>]\n 'git-branch' (-m | -M) [<oldbranch>] <newbranch>\n 'git-branch' (-d | -D) [-r] <branchname>...\n@@ -80,6 +81,9 @@ OPTIONS\n \tAlter minimum display length for sha1 in output listing,\n \tdefault value is 7.\n \n+--no-abbrev::\n+\tDisplay the full sha1s in output listing rather than abbreviating them.\n+\n <branchname>::\n \tThe name of the branch to create or delete.\n \tThe new branch name must pass all checks defined by\n-- \n1.5.0.2\n"}]}