1

Firefox has a profile folder (it has a random name, like r2hy5dsu.default).

If Greasemonkey is installed, then a folder named gm_scripts is created into that folder.
The profile folder contains a LOT of other files and folders, but the only important to me right now is gm_scripts.

So, I would like to create a repository named reponameX (different of r2hy5dsu.default) that contains a folder named dirY (different of gm_scripts) that holds the content of the latter, but I don't know if this is even possible.

LOCAL                                     GITHUB
r2hy5dsu.default                  <-->    reponameX
+ gm_scripts                      <-->    + dirY
+ + ... (a lot of other things)   <-->    + + (I want to sync everything here)
+ ... (a lot of other things)     <-->    + (I don't want to sync it at all)

My question is: Is that possible? If so, how can I accomplish this?

All that I found so far was how to create a repository named differently of your local folder, but nothing about the second part.

This way, it would help me to easily publish and keep updated all the scripts I develop and test myself, without having to copy to somewhere else just to commit it.

Community
  • 1
  • 1
w35l3y
  • 8,613
  • 3
  • 39
  • 51
  • Your original question was apparently downvoted shortly after it was asked. This meant that subscribers like me didn't see it and the activity remained low. Questions with a negative score and low activity (incl no answers) are auto-deleted after a month, Fun, eh? Now, you might want to remove the meta clutter from this question. – Brock Adams Jul 05 '14 at 13:42
  • 1
    Interesting question. What I do is set my `@downloadURL` directive to the release version/location of the file. GM auto picks up the change when it checks for updates. I admit I use cut and paste for rapid development though. Could use better integration myself but haven't taken the time to work it out. – Brock Adams Jul 05 '14 at 13:48
  • You can create a Firefox profile, using any folder you want, using Firefox's profile manager. In fact, it's good to have separate profiles for various testing configurations. – Brock Adams Jul 05 '14 at 13:54
  • Also, the Q's commit approach only works *after* the script is initially installed. You can't just place a new script in that folder (last I checked) and have it run by Greasemonkey. – Brock Adams Jul 05 '14 at 13:56
  • My current problem is gm_scripts can't be named differently into the repo, like dirY. At least, not that I know of. As mentioned in the question. – w35l3y Jul 05 '14 at 14:11
  • Why not name the folder gm_scripts instead of dirY? Also, see [this Q&A](http://stackoverflow.com/q/7633299/331508). – Brock Adams Jul 05 '14 at 15:00
  • Is that possible to change gm_scripts without changing the GM plugin? Do I need to change it every time I update GM ? – w35l3y Jul 06 '14 at 11:50
  • What do you mean? Rename it? No. Once a script is installed by GM, you do not need to change anything. Any changes made to the script in the gm_scripts folder will take effect immediately (with one rare exception). – Brock Adams Jul 06 '14 at 12:14

1 Answers1

0

The cleanest way long-term will be to directly construct a sideband branch, this doesn't touch your current checkout at all:

#!/bin/sh
# Using only a temporary index file,
# Without touching the current checkout or using a worktree at all,
# Commit a hand-rolled commit to an arbitrary branch

$srctree=`git write-tree` # current status, `somecommit` elsewise

export GIT_INDEX_FILE=`mktemp -t`
git read-tree $srctree                    # load up the nonce index

git read-tree --prefix=dirY/ :gm-script   # load `dirY/` from indexed `gm-script`
git rm --cached gm-script                 # remove indexed `gm-script`

tip=`git rev-parse -q for-github -- 2>&-` # commit to the tip of `for-github`
git update-ref refs/heads/for-github \
    $( git commit-tree ${tip:+-p $tip} \
               -m handroll `git write-tree`
    )
jthill
  • 55,082
  • 5
  • 77
  • 137