Commit Graph

6 Commits

Author SHA1 Message Date
brian m. carlson
75fb8f3719
commands: make sure we're in the working tree
In the normal case, Git commands perform repository autodiscovery based
on the current working directory.  However, in some cases, it's possible
to specify a Git working tree unrelated to the current working directory
by using GIT_WORK_TREE.  In such a case, we want to make sure that we
change into the working tree such that our working directory is always
within the working tree, if one exists.  This is what Git does, and it
means that when we write files into the repository, such as a
.gitattributes file, we write them into the proper place.

Note also that we adjust the code to require that the working directory
be non-empty when we require a working copy instead of that the
repository be non-bare.  That's because we don't want people to be
working inside of the Git directory in such situations, where the
repository would be non-bare but would not have a working tree.

We add tests for this case for track and untrack, which require a
working tree, and for checkout, which requires only a repository.  This
means that we can verify the behavior of the functions we've added
without needing to add tests for this case to each of the subcommands.
2020-10-14 20:58:28 +00:00
Leonid S. Usov
d23c4005d0 Fix a redirection typo which has plagued the poor t-untrack.sh before it infects the other kids 2018-08-21 18:10:40 +03:00
Leonid S. Usov
7091986a53 Apply code review suggestions 2018-08-21 18:06:42 +03:00
Leonid S. Usov
255d25d8da Add failing tests for the case of tracking an escaped file name patterns in .gitattributes
`lfs untrack` isn't buggy, but still add similar test for the sake of completeness
2018-08-21 15:36:32 +03:00
Taylor Blau
de9152049c t: load shell scripts from $(dirname) instead of 't' 2018-07-10 13:51:40 -05:00
Taylor Blau
219b7e0a3d t: prefix all existing tests with t- 2018-07-09 16:24:25 -05:00