Skip to content

smudge passthrough - #679

Merged
technoweenie merged 8 commits into
masterfrom
smudge-passthrough
Sep 25, 2015
Merged

technoweenie merged 8 commits into
masterfrom
smudge-passthrough

Conversation

@technoweenie

Copy link
Copy Markdown
Contributor

This is an attempt at a workaround for #616. It's not ideal, but it gives users a way to optimize their downloads at the cost of complicating the git workflow a bit.

# downloads all files through smudge
$ git clone foo/bar.git

# downloads all files in a single batch command instead
$ GIT_LFS_SKIP_SMUDGE=1 git clone foo/bar.git
$ git lfs pull

That workaround sucks. We can make this better for users with:

# update smudge filter for all repos
$ git lfs init --skip-smudge

# update smudge filter for only the local repo
$ git lfs init --skip-smudge --local

@technoweenie

Copy link
Copy Markdown
Contributor Author

Ok, ready for a review!

@rubyist

rubyist commented Sep 23, 2015

Copy link
Copy Markdown
Contributor

Seems good to me. I kind of like the env + pull, it's easily scriptable without altering any configuration. That's not to say we shouldn't keep improving, but I think it's a reasonable place to start.

@technoweenie

Copy link
Copy Markdown
Contributor Author

Not only is it easily scriptable, but it's easily run by native tools too.

@ttaylorr

Copy link
Copy Markdown
Contributor

Looks good to me, glad we got this in 👍

technoweenie added a commit that referenced this pull request Sep 25, 2015
@technoweenie
technoweenie merged commit d402f5b into master Sep 25, 2015
@technoweenie
technoweenie deleted the smudge-passthrough branch September 25, 2015 16:45
@technoweenie technoweenie mentioned this pull request Sep 25, 2015
6 tasks done
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Feb 29, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 1, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 3, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 6, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 10, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Sep 15, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Oct 7, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
chrisd8088 added a commit to chrisd8088/git-lfs that referenced this pull request Oct 30, 2024
The clone_repo*() family of helper functions are used extensively
throughout our test suite; they generally run "git clone" and capture
its output, and then change the working directory to the newly cloned
repository and write the "git clone" output into a log file there
after first calling "git config".

The first introduction of a clone.log file in clone_repo() was in
commit bc025a8 of PR git-lfs#679, and
similar log files are generated by the other functions that were
added later.

One consequence of the way these functions operate now is that,
if the "git clone" command should fail, then because we run all our
tests with the "set -e" option, no log file is generated.  The
function returns immediately, and as the log file is only created
at the end of the function, after changing directories, that step is
skipped.

A partial attempt to work around this behaviour was introduced in
commit 9a00eb3 of PR git-lfs#1893, but only
for the clone_repo_clientcert() function.  The "set +e" option is
temporarily set before running the "git clone" and then the exit code
captured before setting "set -e" again.  This allows the function to
grep for a specific error string in the log file which, if present,
indicates a problem that will not be treated as cause for immediate
failure.

Under most circumstances the current functionality in the other
functions is reasonable as any error messages "git clone" outputs
will appear in the stdout and stderr streams captured by our test
framework for debugging purposes.

However, this leaves no way for tests using these functions to
programmatically check the output of a failed "git clone" attempt.
For instance, if they are looking for a specific string to indicate
that the clone was unable to find a valid Git executable and ran
an invalid one instead (as per CVE-2022-24826), we may want to
be able to search clone.log even after a failure.

Therefore, in order to ensure that log traces are output and saved
in all cases, we change all of the clone_repo*() functions to pipe
the output of "git clone" into a "tee" command, which writes the
log file immediately.  Because the "tee" command is that last one
in the new command pipeline, this means any errors encountered by
"git clone" will not halt the function.

Instead, we capture the "git clone" exit code using PIPESTATUS[0],
and then return if it is non-zero.  If the clone was successful,
however, we proceed to change directory, move the log file into the
new repository (where many existing tests expect it to be available),
and then return after calling "git config".

In the clone_repo_clientcert() function specifically, this change
also allows us to remove the "set +e" temporary setting as it is
no longer useful, and reduce the number of places where we need
to write the log file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants