-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'--tree-ish' is broken #30
Comments
Git's I think this line passed the current submodule commit head to the submodule's |
For short, there's no way to know exact submodule's commit at the master repo's target commit? I tried to illustrate it. In case of below: git archive-all -t a01 archive.tar
Now repo A's
To archive Of course, you shouldn't change the working dir condition.
--- a/git-archive-all.sh
+++ b/git-archive-all.sh
@@ -249,9 +249,9 @@ fi
if [ $VERBOSE -eq 1 ]; then
echo -n "archiving submodules..."
fi
-git submodule >>"$TMPLIST"
+git submodule --cached >>"$TMPLIST"
while read path; do
- TREEISH=$(grep "^ .*${path%/} " "$TMPLIST" | cut -d ' ' -f 2) # git submodule does not list trailing slashes in $path
+ TREEISH=$(grep "^.* ${path%/} " "$TMPLIST" | sed -e 's/^.//' | cut -d ' ' -f 1) # git submodule does not list trailing slashes in $path
cd "$path"
rm -f "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT
git archive --format=$FORMAT --prefix="${PREFIX}$path" $ARCHIVE_OPTS ${TREEISH:-HEAD} > "$TMPDIR"/"$(echo "$path" | sed -e 's/\//./g')"$FORMAT Also, Means,
In case, % git submodule
+__HASH_FOR_THE_UNCOMMITTED_CHANGE__ b (heads/master)
c03xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx c (c03xxxx) % git submodule --cached
+b02xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx b (b02xxxx)
c03xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx c (c03xxxx) Finally, it needs some command to know submodules' status at the specific commit. Now, you'd better not rely on |
How is calling |
Instead, now there exists |
Unfortunately, it was not complete, either. It just checks for the commit of the submodules bounded to the top repo |
Fixed the PR to use
|
I don't understand what the following line (currently at https://github.com/fabacab/git-archive-all.sh/blob/master/git-archive-all.sh#L242 ) attempted to achieve:
This is completely
First of all,
git submodule
only lists the "direct" submodules, not the "transitive" ones. This may be related to #2. Consider using something likegit submodule foreach --recursive pwd
.The
for "clean",
grep
part assumes that the current state of the submodule is clean (the first char is+
for "changes made", etc.). That's not guaranteed. Indeed,git-archive-all.sh --tree-ish
only really makes sense when the given tree-ish is different from HEAD.The
cut
part tries to finish the regex matching that should have been done in grep; seegrep -o
.It doesn't care anywhere about the original
--tree-ish
argument at all.The text was updated successfully, but these errors were encountered: