{"thread":{"id":"42140","subject":"[PATCH] clone: add `--shallow-submodules` flag","startedAt":"2016-04-25T18:30:54Z","lastAt":"2016-04-26T01:08:39Z","messageCount":5,"participants":["Stefan Beller","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"284462","messageId":"1461609054-17118-1-git-send-email-sbeller@google.com","threadId":"42140","inReplyTo":null,"subject":"[PATCH] clone: add `--shallow-submodules` flag","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-04-25T18:30:54Z","receivedAt":"2016-04-25T18:30:54Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"When creating a shallow clone of a repository with submodules, the depth\nargument does not influence the submodules, i.e. the submodules are done\nas non-shallow clones. It is unclear what the best default is for the\ndepth of submodules of a shallow clone, so we need to have the possibility\nto do all kinds of combinations:\n\n* shallow super project with shallow submodules\n  e.g. build bots starting always from scratch. They want to transmit\n  the least amount of network data as well as using the least amount\n  of space on their hard drive.\n* shallow super project with unshallow submodules\n  e.g. The superproject is just there to track a collection of repositories\n  and it is not important to have the relationship between the repositories\n  intact. However the history of the individual submodules matter.\n* unshallow super project with shallow submodules\n  e.g. The superproject is the actual project and the submodule is a\n  library which is rarely touched.\n\nThe new switch to select submodules to be shallow or unshallow supports\nall of these three cases.\n\nIt is easy to transition from the first to the second case by just\nunshallowing the submodules (`git submodule foreach git fetch\n--unshallow`), but it is not possible to transition from the second to the\nfirst case (as we would have already transmitted the non shallow over\nthe network). That is why we want to make the first case the default in\ncase of a shallow super project. This leads to the inconvenience in the\nsecond case with the shallow super project and unshallow submodules,\nas you need to pass `--no-shallow-submodules`.\n\nSigned-off-by: Stefan Beller <sbeller@google.com>\n---\n\n  This replaces origin/sb/clone-shallow-passthru.\n  \n  Thanks Jacob and Lars for review!\n  \nChanges compared to origin/sb/clone-shallow-passthru:\n\n * Dropped the first patch (pass --[no-]local down to submodules).\n   This was only used to ease testing in patch 3, but we can use the\n   file protocol explicitely for now. Instead of a --no-local option Lars\n   rather wants to see a more universal solution for specifying protocol\n   issues (local/non local is just one of them, we may want to clone\n   the submodules with http, while the parent project uses ssh. That option\n   may go into the .gitmodules file as well as a \"preferred protocol\" option?)\n * squashed patches 1 & 2 together (2 was implementing the feature and 3 was\n   testing only, so having just one should do as well.)\n * By squashing there is no need to reword the commit message of the 3rd patch.\n * improved documentation slightly, fixed typo in commit message.\n * deepended the history in the test cases to easier see the outcome, i.e.\n   git clone --depth 2 --recurse-submodules implies a submodule depth of 1.\n   \nThanks,\nStefan\n\n Documentation/git-clone.txt | 13 +++++--\n builtin/clone.c             |  7 ++++\n t/t5614-clone-submodules.sh | 85 +++++++++++++++++++++++++++++++++++++++++++++\n 3 files changed, 102 insertions(+), 3 deletions(-)\n create mode 100755 t/t5614-clone-submodules.sh\n\ndiff --git a/Documentation/git-clone.txt b/Documentation/git-clone.txt\nindex 6db7b6d..e1a21b7 100644\n--- a/Documentation/git-clone.txt\n+++ b/Documentation/git-clone.txt\n@@ -14,8 +14,8 @@ SYNOPSIS\n \t  [-o <name>] [-b <name>] [-u <upload-pack>] [--reference <repository>]\n \t  [--dissociate] [--separate-git-dir <git dir>]\n \t  [--depth <depth>] [--[no-]single-branch]\n-\t  [--recursive | --recurse-submodules] [--jobs <n>] [--] <repository>\n-\t  [<directory>]\n+\t  [--recursive | --recurse-submodules] [--[no-]shallow-submodules]\n+\t  [--jobs <n>] [--] <repository> [<directory>]\n \n DESCRIPTION\n -----------\n@@ -190,7 +190,11 @@ objects from the source repository into a pack in the cloned repository.\n \n --depth <depth>::\n \tCreate a 'shallow' clone with a history truncated to the\n-\tspecified number of revisions.\n+\tspecified number of revisions. Implies `--single-branch` unless\n+\t`--no-single-branch` is given to fetch the histories near the\n+\ttips of all branches. This implies `--shallow-submodules`. If\n+\tyou want to have a shallow superproject clone, but full submodules,\n+\talso pass `--no-shallow-submodules`.\n \n --[no-]single-branch::\n \tClone only the history leading to the tip of a single branch,\n@@ -214,6 +218,9 @@ objects from the source repository into a pack in the cloned repository.\n \trepository does not have a worktree/checkout (i.e. if any of\n \t`--no-checkout`/`-n`, `--bare`, or `--mirror` is given)\n \n+--[no-]shallow-submodules::\n+\tAll submodules which are cloned will be shallow with a depth of 1.\n+\n --separate-git-dir=<git dir>::\n \tInstead of placing the cloned repository where it is supposed\n \tto be, place the cloned repository at the specified directory,\ndiff --git a/builtin/clone.c b/builtin/clone.c\nindex b004fb4..ecdf308 100644\n--- a/builtin/clone.c\n+++ b/builtin/clone.c\n@@ -40,6 +40,7 @@ static const char * const builtin_clone_usage[] = {\n \n static int option_no_checkout, option_bare, option_mirror, option_single_branch = -1;\n static int option_local = -1, option_no_hardlinks, option_shared, option_recursive;\n+static int option_shallow_submodules = -1;\n static char *option_template, *option_depth;\n static char *option_origin = NULL;\n static char *option_branch = NULL;\n@@ -91,6 +92,8 @@ static struct option builtin_clone_options[] = {\n \t\t    N_(\"create a shallow clone of that depth\")),\n \tOPT_BOOL(0, \"single-branch\", &option_single_branch,\n \t\t    N_(\"clone only one branch, HEAD or --branch\")),\n+\tOPT_BOOL(0, \"shallow-submodules\", &option_shallow_submodules,\n+\t\t    N_(\"any cloned submodules will be shallow\")),\n \tOPT_STRING(0, \"separate-git-dir\", &real_git_dir, N_(\"gitdir\"),\n \t\t   N_(\"separate git dir from working tree\")),\n \tOPT_STRING_LIST('c', \"config\", &option_config, N_(\"key=value\"),\n@@ -727,6 +730,10 @@ static int checkout(void)\n \t\tstruct argv_array args = ARGV_ARRAY_INIT;\n \t\targv_array_pushl(&args, \"submodule\", \"update\", \"--init\", \"--recursive\", NULL);\n \n+\t\tif (option_shallow_submodules == 1\n+\t\t    || (option_shallow_submodules == -1 && option_depth))\n+\t\t\targv_array_push(&args, \"--depth=1\");\n+\n \t\tif (max_jobs != -1)\n \t\t\targv_array_pushf(&args, \"--jobs=%d\", max_jobs);\n \ndiff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh\nnew file mode 100755\nindex 0000000..825f511\n--- /dev/null\n+++ b/t/t5614-clone-submodules.sh\n@@ -0,0 +1,85 @@\n+#!/bin/sh\n+\n+test_description='Test shallow cloning of repos with submodules'\n+\n+. ./test-lib.sh\n+\n+p=$(pwd)\n+\n+test_expect_success 'setup' '\n+\tgit checkout -b master &&\n+\ttest_commit commit1 &&\n+\ttest_commit commit2 &&\n+\tmkdir sub &&\n+\t(\n+\t\tcd sub &&\n+\t\tgit init &&\n+\t\ttest_commit subcommit1 &&\n+\t\ttest_commit subcommit2 &&\n+\t\ttest_commit subcommit3\n+\t) &&\n+\tgit submodule add \"file://$p/sub\" sub &&\n+\tgit commit -m \"add submodule\"\n+'\n+\n+test_expect_success 'nonshallow clone implies nonshallow submodule' '\n+\ttest_when_finished \"rm -rf super_clone\" &&\n+\tgit clone --recurse-submodules \"file://$p/.\" super_clone &&\n+\t(\n+\t\tcd super_clone &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 3 lines\n+\t) &&\n+\t(\n+\t\tcd super_clone/sub &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 3 lines\n+\t)\n+'\n+\n+test_expect_success 'shallow clone implies shallow submodule' '\n+\ttest_when_finished \"rm -rf super_clone\" &&\n+\tgit clone --recurse-submodules --depth 2 \"file://$p/.\" super_clone &&\n+\t(\n+\t\tcd super_clone &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 2 lines\n+\t) &&\n+\t(\n+\t\tcd super_clone/sub &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 1 lines\n+\t)\n+'\n+\n+test_expect_success 'shallow clone with non shallow submodule' '\n+\ttest_when_finished \"rm -rf super_clone\" &&\n+\tgit clone --recurse-submodules --depth 2 --no-shallow-submodules \"file://$p/.\" super_clone &&\n+\t(\n+\t\tcd super_clone &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 2 lines\n+\t) &&\n+\t(\n+\t\tcd super_clone/sub &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 3 lines\n+\t)\n+'\n+\n+test_expect_success 'non shallow clone with shallow submodule' '\n+\ttest_when_finished \"rm -rf super_clone\" &&\n+\tgit clone --recurse-submodules --no-local --shallow-submodules \"file://$p/.\" super_clone &&\n+\t(\n+\t\tcd super_clone &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 3 lines\n+\t) &&\n+\t(\n+\t\tcd super_clone/sub &&\n+\t\tgit log --oneline >lines &&\n+\t\ttest_line_count = 1 lines\n+\t)\n+'\n+\n+test_done\n-- \n2.7.0.rc0.39.g5327a53\n"},{"id":"284480","messageId":"xmqqd1pdjt7m.fsf@gitster.mtv.corp.google.com","threadId":"42140","inReplyTo":"1461609054-17118-1-git-send-email-sbeller@google.com","subject":"Re: [PATCH] clone: add `--shallow-submodules` flag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-25T21:04:29Z","receivedAt":"2016-04-25T21:04:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n>   This replaces origin/sb/clone-shallow-passthru.\n> @@ -190,7 +190,11 @@ objects from the source repository into a pack in the cloned repository.\n>  \n>  --depth <depth>::\n>  \tCreate a 'shallow' clone with a history truncated to the\n> -\tspecified number of revisions.\n> +\tspecified number of revisions. Implies `--single-branch` unless\n> +\t`--no-single-branch` is given to fetch the histories near the\n> +\ttips of all branches. This implies `--shallow-submodules`. If\n> +\tyou want to have a shallow superproject clone, but full submodules,\n> +\talso pass `--no-shallow-submodules`.\n\nThis is not wrong per-se but the early half of the new text seems to\ncome from 28a1b569 (docs: clarify that passing --depth to git-clone\nimplies --single-branch, 2016-01-06), which was merged to 'master'\nsome time ago.\n\nI've resolved the conflicts coming from the duplicates, so no need\nto resend, but the resulting history would become misleading.  I am\nundecided if I should rebasing this on top of 85705cfb (Merge branch\n'ss/clone-depth-single-doc', 2016-01-20) or later.\n\n> diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh\n> new file mode 100755\n> index 0000000..825f511\n> --- /dev/null\n> +++ b/t/t5614-clone-submodules.sh\n> @@ -0,0 +1,85 @@\n> +#!/bin/sh\n> +\n> +test_description='Test shallow cloning of repos with submodules'\n> +\n> +. ./test-lib.sh\n> +\n> +p=$(pwd)\n\nA single-letter lower-case global that needs to stay constant for\nthe entire file looks like a ticking time bomb screaming to be\nbroken by future updates.  I see $D used for this purpose in many\nscripts, $here and $top in some, and $TRASH in yet some others.\nPerhaps $D may be more appropriate if we wanted to keep this\nultra-short-and-cryptic while mimicking existing ones.\n\n> +test_expect_success 'setup' '\n> +\tgit checkout -b master &&\n> +\ttest_commit commit1 &&\n> +\ttest_commit commit2 &&\n> +\tmkdir sub &&\n> +\t(\n> +\t\tcd sub &&\n> +\t\tgit init &&\n> +\t\ttest_commit subcommit1 &&\n> +\t\ttest_commit subcommit2 &&\n> +\t\ttest_commit subcommit3\n> +\t) &&\n> +\tgit submodule add \"file://$p/sub\" sub &&\n> +\tgit commit -m \"add submodule\"\n> +'\n> +\n> +test_expect_success 'nonshallow clone implies nonshallow submodule' '\n> +\ttest_when_finished \"rm -rf super_clone\" &&\n> +\tgit clone --recurse-submodules \"file://$p/.\" super_clone &&\n> +\t(\n> +\t\tcd super_clone &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 3 lines\n> +\t) &&\n> +\t(\n> +\t\tcd super_clone/sub &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 3 lines\n> +\t)\n> +'\n> +\n> +test_expect_success 'shallow clone implies shallow submodule' '\n> +\ttest_when_finished \"rm -rf super_clone\" &&\n> +\tgit clone --recurse-submodules --depth 2 \"file://$p/.\" super_clone &&\n> +\t(\n> +\t\tcd super_clone &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 2 lines\n> +\t) &&\n> +\t(\n> +\t\tcd super_clone/sub &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 1 lines\n> +\t)\n> +'\n> +\n> +test_expect_success 'shallow clone with non shallow submodule' '\n> +\ttest_when_finished \"rm -rf super_clone\" &&\n> +\tgit clone --recurse-submodules --depth 2 --no-shallow-submodules \"file://$p/.\" super_clone &&\n> +\t(\n> +\t\tcd super_clone &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 2 lines\n> +\t) &&\n> +\t(\n> +\t\tcd super_clone/sub &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 3 lines\n> +\t)\n> +'\n> +\n> +test_expect_success 'non shallow clone with shallow submodule' '\n> +\ttest_when_finished \"rm -rf super_clone\" &&\n> +\tgit clone --recurse-submodules --no-local --shallow-submodules \"file://$p/.\" super_clone &&\n> +\t(\n> +\t\tcd super_clone &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 3 lines\n> +\t) &&\n> +\t(\n> +\t\tcd super_clone/sub &&\n> +\t\tgit log --oneline >lines &&\n> +\t\ttest_line_count = 1 lines\n> +\t)\n> +'\n> +\n> +test_done\n"},{"id":"284487","messageId":"CAGZ79kbPcefodLd4Jt4tvJJmHZXJGe-AMEgzREWZiUvNeciFSQ@mail.gmail.com","threadId":"42140","inReplyTo":"xmqqd1pdjt7m.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] clone: add `--shallow-submodules` flag","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-04-25T21:25:32Z","receivedAt":"2016-04-25T21:25:32Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Apr 25, 2016 at 2:04 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stefan Beller <sbeller@google.com> writes:\n>\n>>   This replaces origin/sb/clone-shallow-passthru.\n>> @@ -190,7 +190,11 @@ objects from the source repository into a pack in the cloned repository.\n>>\n>>  --depth <depth>::\n>>       Create a 'shallow' clone with a history truncated to the\n>> -     specified number of revisions.\n>> +     specified number of revisions. Implies `--single-branch` unless\n>> +     `--no-single-branch` is given to fetch the histories near the\n>> +     tips of all branches. This implies `--shallow-submodules`. If\n>> +     you want to have a shallow superproject clone, but full submodules,\n>> +     also pass `--no-shallow-submodules`.\n>\n> This is not wrong per-se but the early half of the new text seems to\n> come from 28a1b569 (docs: clarify that passing --depth to git-clone\n> implies --single-branch, 2016-01-06), which was merged to 'master'\n> some time ago.\n>\n> I've resolved the conflicts coming from the duplicates, so no need\n> to resend, but the resulting history would become misleading.  I am\n> undecided if I should rebasing this on top of 85705cfb (Merge branch\n> 'ss/clone-depth-single-doc', 2016-01-20) or later.\n\nI could reroll with another variable name on top of 85705cfb?\n\n>\n>> diff --git a/t/t5614-clone-submodules.sh b/t/t5614-clone-submodules.sh\n>> new file mode 100755\n>> index 0000000..825f511\n>> --- /dev/null\n>> +++ b/t/t5614-clone-submodules.sh\n>> @@ -0,0 +1,85 @@\n>> +#!/bin/sh\n>> +\n>> +test_description='Test shallow cloning of repos with submodules'\n>> +\n>> +. ./test-lib.sh\n>> +\n>> +p=$(pwd)\n>\n> A single-letter lower-case global that needs to stay constant for\n> the entire file looks like a ticking time bomb screaming to be\n> broken by future updates.\n\nI agree. How about `currentdir`, `testdir` or `testtop` instead?\nThat is slightly longer than `D`, `here` or `top`, but is slightly more\ninformative. $TRASH would also work for me.\n\nTalking about time bombs: I see there are many tests in single files\n(e.g. 7412 has ~80 tests IIRC and adding a test in there I often spend\nmore time figuring out the current state of the testing directory rather than\nwriting the test.\n\nSo I'd rather see more testing files with fewer tests rather than a few\nfiles with all the tests for one topic. (e.g. these tests could have gone\ninto the clone tests, or the basic submodule tests, but instead I chose\na new file to test this.)\n\n\n> I see $D used for this purpose in many\n> scripts, $here and $top in some, and $TRASH in yet some others.\n> Perhaps $D may be more appropriate if we wanted to keep this\n> ultra-short-and-cryptic while mimicking existing ones.\n\nI was not keen on being ultrashort, rather I was toying around\nto drop the patch introducing the --no-local option.\n\n>\n>> +test_expect_success 'setup' '\n>> +     git checkout -b master &&\n>> +     test_commit commit1 &&\n>> +     test_commit commit2 &&\n>> +     mkdir sub &&\n>> +     (\n>> +             cd sub &&\n>> +             git init &&\n>> +             test_commit subcommit1 &&\n>> +             test_commit subcommit2 &&\n>> +             test_commit subcommit3\n>> +     ) &&\n>> +     git submodule add \"file://$p/sub\" sub &&\n>> +     git commit -m \"add submodule\"\n>> +'\n>> +\n>> +test_expect_success 'nonshallow clone implies nonshallow submodule' '\n>> +     test_when_finished \"rm -rf super_clone\" &&\n>> +     git clone --recurse-submodules \"file://$p/.\" super_clone &&\n>> +     (\n>> +             cd super_clone &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 3 lines\n>> +     ) &&\n>> +     (\n>> +             cd super_clone/sub &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 3 lines\n>> +     )\n>> +'\n>> +\n>> +test_expect_success 'shallow clone implies shallow submodule' '\n>> +     test_when_finished \"rm -rf super_clone\" &&\n>> +     git clone --recurse-submodules --depth 2 \"file://$p/.\" super_clone &&\n>> +     (\n>> +             cd super_clone &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 2 lines\n>> +     ) &&\n>> +     (\n>> +             cd super_clone/sub &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 1 lines\n>> +     )\n>> +'\n>> +\n>> +test_expect_success 'shallow clone with non shallow submodule' '\n>> +     test_when_finished \"rm -rf super_clone\" &&\n>> +     git clone --recurse-submodules --depth 2 --no-shallow-submodules \"file://$p/.\" super_clone &&\n>> +     (\n>> +             cd super_clone &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 2 lines\n>> +     ) &&\n>> +     (\n>> +             cd super_clone/sub &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 3 lines\n>> +     )\n>> +'\n>> +\n>> +test_expect_success 'non shallow clone with shallow submodule' '\n>> +     test_when_finished \"rm -rf super_clone\" &&\n>> +     git clone --recurse-submodules --no-local --shallow-submodules \"file://$p/.\" super_clone &&\n>> +     (\n>> +             cd super_clone &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 3 lines\n>> +     ) &&\n>> +     (\n>> +             cd super_clone/sub &&\n>> +             git log --oneline >lines &&\n>> +             test_line_count = 1 lines\n>> +     )\n>> +'\n>> +\n>> +test_done\n"},{"id":"284501","messageId":"xmqqvb35iabx.fsf@gitster.mtv.corp.google.com","threadId":"42140","inReplyTo":"CAGZ79kbPcefodLd4Jt4tvJJmHZXJGe-AMEgzREWZiUvNeciFSQ@mail.gmail.com","subject":"Re: [PATCH] clone: add `--shallow-submodules` flag","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2016-04-25T22:37:38Z","receivedAt":"2016-04-25T22:37:38Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> I agree. How about `currentdir`, `testdir` or `testtop` instead?\n> That is slightly longer than `D`, `here` or `top`, but is slightly more\n> informative. $TRASH would also work for me.\n\nI would not be happy to see a patch that adds yet another variable\nthat is never used so far, like currentdir, testdir, or testtop.\n\nAmong the ones I found that are already in use, $here is probably my\nfavourite, because it does _not_ have to be set to the top; it just\nsays \"this is the directory my main focus is in\".\n\nHaving said that, personally, I find $D (as long as D is in capital)\nis distinctive and descriptive enough.\n"},{"id":"284504","messageId":"CAGZ79kYJeqjoxXmcoe8ZdsdpwEjFrf4MtOuJsZ3EZr0NMuNAaQ@mail.gmail.com","threadId":"42140","inReplyTo":"xmqqvb35iabx.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH] clone: add `--shallow-submodules` flag","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2016-04-26T01:08:39Z","receivedAt":"2016-04-26T01:08:39Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Mon, Apr 25, 2016 at 3:37 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stefan Beller <sbeller@google.com> writes:\n>\n>> I agree. How about `currentdir`, `testdir` or `testtop` instead?\n>> That is slightly longer than `D`, `here` or `top`, but is slightly more\n>> informative. $TRASH would also work for me.\n>\n> I would not be happy to see a patch that adds yet another variable\n> that is never used so far, like currentdir, testdir, or testtop.\n\nD seems to be popular in 5510, the submodule crowd seems to prefer\n$pwd though, see\nt5526-fetch-submodules.sh\nt7406-submodule-update.sh\nt7407-submodule-foreach.s\nt7400-submodule-basic.sh\n\nas grep -r \"\\$pwd\" put it.\n\n>\n> Among the ones I found that are already in use, $here is probably my\n> favourite, because it does _not_ have to be set to the top; it just\n> says \"this is the directory my main focus is in\".\n>\n> Having said that, personally, I find $D (as long as D is in capital)\n> is distinctive and descriptive enough.\n\nI rather go with pwd for now (it keeps the submodule stuff consistent),\n\nThanks,\nStefan\n"}]}