Repository navigation
smudge passthrough - #679
Merged
Merged
Conversation
Contributor
Author
|
Ok, ready for a review! |
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. |
Contributor
Author
|
Not only is it easily scriptable, but it's easily run by native tools too. |
Contributor
|
Looks good to me, glad we got this in 👍 |
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
That workaround sucks. We can make this better for users with: