Commit Graph

8 Commits

Author SHA1 Message Date
Suman Kashyap
3eb8bcf3e7 Rename ls-files --name option to --name-only (-n) 2018-09-20 09:38:17 -07:00
Suman Kashyap
1b1e1af8cc Adding support for showing only lfs tracked file names without additional information 2018-09-19 16:16:18 -07:00
brian m. carlson
b2ddccd90d t: avoid using shell variables in printf's first argument
The printf(1) command, like it's C cousin, takes a format string as its
first argument.  If a shell variable is passed as the first argument, it
will be interpreted as a format string; this can lead to surprising
behavior and can cause the test suite to fail if we accidentally insert
a format string character into the variable.

Modify all the places in the individual tests that we use a plain quoted
variable as the format string by running the following Ruby one-liner:

  ruby -i -pe '$_.gsub!(/printf "\$/, %q(printf "%s" "$))' t/t-*.sh

Avoid modifying the test helpers, as there are places (such as calc_oid)
where we want to pass text containing escapes (such as "\n") and have
those be properly interpreted by printf(1).
2018-09-10 14:57:10 +00:00
Taylor Blau
cc7b83a9b9 commands/command_ls_files: hide index with arguments
Since e2717688 (commands: scan repository index in git-lfs-ls-files(1),
2017-12-19), we have traversed the contents of the index when showing
files in 'git lfs ls-files'.

The purpose of this was to match behavior in 'git ls-files', where the
index is also shown by default.

However, when given an argument, 'git lfs ls-files' will traverse
starting from a specific revision, so showing the index unconditionally
causes a problem here. It does not make sense to show the current state
of the index when listing files when given a starting point explicitly.

So, let's skip calling into the gitscanner code when given an explicit
reference to start from (even if that reference is HEAD, since this
likely indicates that the user does not want to scan the index, too).
2018-09-05 10:33:27 -04:00
Taylor Blau
6db67f2ca5 commands/command_ls_files.go: don't accept "git lfs ls-files -- --all"
In 05d65e75 (commands/ls-files: do not accept '--all' after '--',
2018-03-20), we encountered an interesting situation in which the
following command invocation:

    $ git lfs ls-files -- --all

Was treated as if "--all" were a reference name, and thusly passed to
git.ResolveRef(), and ultimately to "git rev-parse", as "git rev-parse
--all", which is a valid execution of "git rev-parse".

Thus, we'll get an odd result. Instead, let's trap that case early, and
return an appropriate error.
2018-09-05 10:18:38 -04:00
Taylor Blau
04a398b014 t: convert encoding in t-ls-files.sh 2018-07-11 17:05:33 -05:00
Taylor Blau
f2fd813c9d t: fix more source-ing from the wrong location 2018-07-11 13:18:25 -05:00
Taylor Blau
219b7e0a3d t: prefix all existing tests with t- 2018-07-09 16:24:25 -05:00