Commit Graph

5 Commits

Author SHA1 Message Date
Hervé Beraud fb9efaa018 Make oslo.tools more usable by newcomers
These changes make oslo.tools more user friendly by documenting tools
introducing commands shortcut etc...

Introduced changes:
- add doc and build it with tox
- add tox and shortcut commands
- centralize tools
- launch zuul jobs
- apply pep8
- apply bashate

Change-Id: I0f948c9f507b8c951c5748265699a2f515350ff9
2020-03-30 11:31:52 +02:00
Scott Little 6b06d7d7e1 filter_git_history.sh passes broken parent-filter to git filter-branch
Problem:
    filter_git_history.sh, when passed a list if directories to filter,
 sometimes passes a bad arguement to git filter-branch.

e.g.

filter_git_history.sh <dir1> <dir2> <dir3>

results in ...

git filter-branch ... --parent-filter '<bad arg>' ...

resulting in logs ....

Rewrite 1a32385367efab7a2bccf63981993b322e0d4b4c (1/866)/usr/lib/git-core/git-filter-branch: line 340: [: missing `]'
/usr/lib/git-core/git-filter-branch: line 341: -o: command not found
Rewrite 3cd12006bb6e7c9157f6b0f82a10d0c8cd63e334 (2/866)/usr/lib/git-core/git-filter-branch: line 340: [: missing `]'
/usr/lib/git-core/git-filter-branch: line 341: -o: command not found

The issue appears to be carriage returns in variable 'set_roots'.
Specifically the expresion within the '[' ']' pair seems to be incompatible with
carriage returns.

If I run with bash debugging turned on, I see the for loop at
line 45 iterated twice, producing the following output.

+ set_roots='
if [ 1 -eq 0  -o "$GIT_COMMIT" = '\''1232ac58be82479ddf1af7f7eb335103cb883356'\''
 -o "$GIT_COMMIT" = '\''ffe029ef99c501a0076ad6106a364bbb9c0d80ea'\''  ]; then
    echo '\'''\'';
else
    cat;
fi'

Note that there is a carriage return prior to the second -o clause.
My theory is that within git-filter-branch, bash is being invoked twice.

First call:
    if [ 1 -eq 0  -o "$GIT_COMMIT" = '\''1232ac58be82479ddf1af7f7eb335103cb883356'\''

resulting in:
    git-filter-branch: line 340: [: missing `]'

Second call:
     -o "$GIT_COMMIT" = '\''ffe029ef99c501a0076ad6106a364bbb9c0d80ea'\''  ]; then
        echo '\'''\'';
    else
        cat;
    fi

resulting in:
   git-filter-branch: line 341: -o: command not found

Other details:
   bash 4.3-7ubuntu1.7
   git  1:1.9.1-1ubuntu0.10

Solution
   Use 'echo -n' rather than 'echo' when constructing 'set_roots'.

Which results in ...

+ set_roots='
if [ 1 -eq 0  -o "$GIT_COMMIT" = '\''1232ac58be82479ddf1af7f7eb335103cb883356'\'' -o "$GIT_COMMIT" = '\''ffe029ef99c501a0076ad6106a364bbb9c0d80ea'\''  ]; then
    echo '\'''\'';
else
    cat;
fi'

The entire '[' ']' expression is on the same line, and the git-filter-branch go away.

Change-Id: I3a21fd0841f093495cf4727a9f5633a6f80c1690
Signed-off-by: Scott Little <scott.little@windriver.com>
2019-07-12 10:50:11 -04:00
Dean Troyer 5c0df7ef13 Fix command error in filter
An apparently missing space in an if condition causes a command not
found error.

Change-Id: I40e2ea3dbe6f2ce507e9aaa7a563054d009f9c0b
2018-04-27 17:25:48 -05:00
Zhao Lei 19378504b5 Remove quotes from subshell call in bash script
Always no quotes for $() statement.

We don't need quotes to hold blanks in result:
 # i=$(echo 1 2 3)
 # echo $i
 1 2 3
 #

These quotes can make something wrong in some case:
 # i=$(echo '!')
 #
 # i="$(echo '!')"
 -bash: !: event not found
 #

No real problem for current code, only to use a better code style.

Change-Id: I3c87987d3b992c8363ef236a04ae6e35c1315535
Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
2015-09-23 18:44:33 +08:00
Doug Hellmann 98fd73c337 Refactor graduate.sh
Split graduate.sh into a couple of different scripts so they can be used
to export code from repositories other than oslo-incubator.

Change-Id: I6334f132657b4c26a707779afdd50b04915bfeb8
Blueprint: adopt-oslo-versionedobjects
2015-01-28 17:51:46 -05:00