Commit Graph

10 Commits

Author SHA1 Message Date
Chris Darroch
739fbbcef2 t: revise ls-tree path matching in pointer helpers
The assert_pointer() and refute_pointer() test helper functions
use grep to match specific lines of output from "git ls-tree".
However, while assert_pointer() matches with fixed patterns by using
grep's -F option, refute_pointer() does not.  This difference was
introduced in commit fc421da1c176a9d0844a38e6eb2cba154d864069 of
PR #3756, so we update refute_pointer() here to match.

In a subsequent PR we will also need to ensure that the file paths
we provide as arguments to these functions (specifically, to
assert_pointer()) do not match just any part of the paths output
by "git ls-tree", but only at the start of the path.  That is,
"a.bin" should match "a.bin" but not "foo/a.bin".

Because the output from "git ls-tree" is space-separated, we
prepend a space to our fixed patterns so we match against the
start of the file path.  This has the limitation that if a test
has a file named "foo a.bin", and calls one of these functions with
just the filename "a.bin", it will incorrectly match the filename
with a space.

However, at present only one of our tests that calls either of these
functions, specifically the "track: escaped glob pattern with spaces
in .gitattributes" test in t/t-track.sh, has a filename with a
space in it, and does not create any additional files which might
be confused by that filename.
2022-04-25 02:37:49 -07:00
Chris Darroch
774ab58fa7 commands,git,t: fail migration on gitattrs symlink
If during a migration operation a .gitattributes blob is found
which needs to be modified by the migration, and it is a symbolic
link rather than a regular blob object, we halt the migration
with an error.

We add tests for the import, export, and info sub-commands which
exercise this new behaviour, including with and without the --fixup
option for the import and info sub-commands.

Note that this is an unexpected condition because .gitattributes
files should never be symbolic links, as Git itself will complain
about them with "Too many levels of symbolic links" warning messages.
2022-01-30 18:46:02 -08:00
brian m. carlson
88b7a5ae19
commands/migrate: make strings translatable 2022-01-18 17:03:37 +00:00
brian m. carlson
9e006ac4e2
Rename default branch in tests to "main"
Currently, our default branch in tests is "master".  This is the Git
default, but the Git default will likely change in the future, so it
makes sense to update our testsuite to be explicit about the branch
name.  We'll ensure this continues by building against older versions of
Git as well as newer versions.

We use "main" for the new branch name, since that's the proposed value
upstream.

This commit was made entirely by automated means using the following
command:

  git grep -l master t | xargs sed -i -e 's/master/main/g'
2020-07-08 15:38:17 +00:00
brian m. carlson
2877dbe5be
git: avoid trying to rewrite remote tags as remote branches
When invoking "git lfs migrate import --fixup", we call Git to fetch the
remote branches and tags.  However, we mark both as having the type
remote branch, so when we look up the local copies for them, we try to
use the tag name as the name of a remote tracking branch, which fails.

Instead, let's mark them as remote tags, which means we won't try to
rewrite them into branches at all.  This ensures the operation can
succeed.

While we're here, let's fix a typo and put a period at the end of our
sentence.
2020-04-15 13:42:17 +00:00
Taylor Blau
351c81fc5d Merge branch 'master' into ttaylorr/prove 2018-07-23 11:12:04 -05:00
Taylor Blau
e0ed17dd0f t: move 't-migrate-fixtures.sh' to 'fixtures' 2018-07-11 13:18:25 -05:00
Taylor Blau
f2fd813c9d t: fix more source-ing from the wrong location 2018-07-11 13:18:25 -05: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