Skip to content

Commit 57f3519

Browse files
committed
Merge pull request #53 from rouson/branch-1.0.0
Adding the gitkeep.sh script that writes empty ".gitkeep" files at th…
2 parents 05c1872 + 3927c58 commit 57f3519

File tree

8 files changed

+80
-5
lines changed

8 files changed

+80
-5
lines changed

doc/dependency_tree/gitkeep.sh

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#!/bin/bash
2+
#
3+
# gitkeep.sh
4+
#
5+
6+
description=\
7+
'bash script for adding empty ".gitkeep" files at the branch ends of empty directory trees'
8+
9+
use_case=\
10+
"Use case:
11+
12+
Force git to track otherwise empty directories such as doc/dependency_tree/opencoarrays,
13+
which exists solely for purposes of displaying the OpenCoarrays dependency tree via the
14+
command 'tree opencoarrays'."
15+
#
16+
# OpenCoarrays is distributed under the OSI-approved BSD 3-clause License:
17+
# Copyright (c) 2015, Sourcery, Inc.
18+
# Copyright (c) 2015, Sourcery Institute
19+
# All rights reserved.
20+
#
21+
# Redistribution and use in source and binary forms, with or without modification,
22+
# are permitted provided that the following conditions are met:
23+
#
24+
# 1. Redistributions of source code must retain the above copyright notice, this
25+
# list of conditions and the following disclaimer.
26+
# 2. Redistributions in binary form must reproduce the above copyright notice, this
27+
# list of conditions and the following disclaimer in the documentation and/or
28+
# other materials provided with the distribution.
29+
# 3. Neither the names of the copyright holders nor the names of their contributors
30+
# may be used to endorse or promote products derived from this software without
31+
# specific prior written permission.
32+
#
33+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
34+
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
35+
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
36+
# IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
37+
# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
38+
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
39+
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
40+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
41+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
42+
# POSSIBILITY OF SUCH DAMAGE.
43+
#
44+
this_script=`basename $0`
45+
46+
usage()
47+
{
48+
echo ""
49+
echo " $this_script - $description"
50+
echo ""
51+
echo " Usage: "
52+
echo " $this_script <path-to-modify>"
53+
echo ""
54+
echo " Examples:"
55+
echo ""
56+
echo " $this_script ."
57+
echo ""
58+
printf "$use_case"
59+
exit 1
60+
}
61+
62+
# If this script is invoked without arguements, print usage information
63+
# and terminate execution of the script.
64+
if [[ $# == 0 || "$1" == "-h" || "$1" == "--help" ]]; then
65+
usage | less
66+
exit 1
67+
fi
68+
69+
# Interpret the first argument as the name of the directory tree to fill
70+
export path_to_modify=$1
71+
72+
# Create an empty ".gitkeep" file in all empty subdirectories
73+
find $path_to_modify -type d -empty -exec touch {}/.gitkeep \;
+5-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
opencoarrays/
1+
opencoarrays
22
├── cmake-3.4.0
33
└── mpich-3.1.4
4-
└── gcc-5.1
4+
└── gcc-5.1.0
55
├── flex-2.6.0
6-
│   └── bison-yacc-3.0.4
6+
│   └── bison-3.0.4
77
├── gmp
88
├── mpc
99
└── mpfr
10+
11+
8 directories, 0 files

doc/dependency_tree/opencoarrays/cmake-3.4.0/.gitkeep

Whitespace-only changes.

doc/dependency_tree/opencoarrays/mpich-3.1.4/gcc-5.1.0/flex-2.6.0/bison-3.0.4/.gitkeep

Whitespace-only changes.

doc/dependency_tree/opencoarrays/mpich-3.1.4/gcc-5.1.0/gmp/.gitkeep

Whitespace-only changes.

doc/dependency_tree/opencoarrays/mpich-3.1.4/gcc-5.1.0/mpc/.gitkeep

Whitespace-only changes.

doc/dependency_tree/opencoarrays/mpich-3.1.4/gcc-5.1.0/mpfr/.gitkeep

Whitespace-only changes.

install.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,8 @@ print_header()
644644
# dynamically compute and print the tree, suppressing the final line
645645
tree opencoarrays | sed '$d'
646646
else
647-
# print the most recently saved static depiction of the tree
648-
cat opencoarrays-tree.txt
647+
# print the most recently saved output of the above 'tree' command
648+
cat opencoarrays-tree.txt | sed '$d'
649649
fi
650650
popd > /dev/null
651651
echo ""

0 commit comments

Comments
 (0)