Skip to content

yadm and attibutes #199

@choman

Description

@choman

When using yadm with transcript (BTW great combo of two awesome scripts). transcrypt cannot accurately determine the location of the GIT_ATTRIBUTES file.

I started off with .gitattributes in HOME, then for cleanliness I mv the .gitattibutes to the repos/info dir. After doing a
bit of digging that the "IS_BARE" check doesn't work correctly as yadm is a wrapper around git.

I horribly solution I cam up with to resolve this is to somehow check if current execution of transcrypt was called from yadm. Horrible I say

choman   1528761  910306  0 14:43 pts/0    00:00:00 bash /usr/local/bin/yadm transcrypt --add test
choman   1528769 1528761  0 14:43 pts/0    00:00:00 bash /usr/local/bin/transcrypt --add test

so perhaps the GIT_ATTRIBUTE check can be extended to use this

is_called_by_yadm() {
  pid=$$
  while [[ "$pid" -gt 1 ]]; do
    parent=$(ps -o ppid= -p "$pid" | tr -d ' ')
    args=$(ps -o args= -p "$parent")
    if echo "$args" | grep -q 'yadm'; then
      return 0
    fi
    pid=$parent
  done
  return 1
}

if is_called_by_yadm; then
        echo "YADM CALLED"
else
        echo "NOT YADM CALLED"
fi

And check if the attributes is in the .local/share/yadm/repo.git/info folder.
and if not there then finally default to .gitattibutes at the home directory level

It also seems like IS_BARE should be just also set to true in this scenario to alleviate other hacks in the script

anyways, thought i would pass this along. probably not the best fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions