[GH-ISSUE #3] Tilde expansion not supported #2

Closed
opened 2026-03-02 16:46:59 +03:00 by kerem · 1 comment
Owner

Originally created by @anothermh on GitHub (Jan 22, 2023).
Original GitHub issue: https://github.com/initialcommit-com/git-sim/issues/3

Tilde expansion is not supported. For example, consider the following command:

git-sim --media-dir=~/temp log

The expectation is that media-dir will map to $HOME/temp, for example /Users/foo/temp. Instead it maps to the current directory and creates a sub-directory with the literal name ~, e.g. ./~/temp:

└── ~
    └── temp
        └── git-sim_media
            ├── images
            ├── texts
            └── videos
                └── 1080p60
                    └── partial_movie_files
                        └── GitSim

This was tested on macOS using both ZSH and fish for the shell, using python 3.11.1.

The problem appears to be here:

github.com/initialcommit-com/git-sim@c2effc2669/git_sim/main.py#L79

Using os.path.expanduser will allow tilde expansion.

Originally created by @anothermh on GitHub (Jan 22, 2023). Original GitHub issue: https://github.com/initialcommit-com/git-sim/issues/3 [Tilde expansion](https://www.gnu.org/software/bash/manual/html_node/Tilde-Expansion.html) is not supported. For example, consider the following command: ```shell git-sim --media-dir=~/temp log ``` The expectation is that `media-dir` will map to `$HOME/temp`, for example `/Users/foo/temp`. Instead it maps to the current directory and creates a sub-directory with the literal name `~`, e.g. `./~/temp`: ```shell └── ~ └── temp └── git-sim_media ├── images ├── texts └── videos └── 1080p60 └── partial_movie_files └── GitSim ``` This was tested on macOS using both ZSH and fish for the shell, using python 3.11.1. The problem appears to be here: https://github.com/initialcommit-com/git-sim/blob/c2effc266970bc4be373f1868fec8beb9ee885ed/git_sim/__main__.py#L79 Using [`os.path.expanduser`](https://stackoverflow.com/a/2057072/3784008) will allow tilde expansion.
kerem closed this issue 2026-03-02 16:46:59 +03:00
Author
Owner

@initialcommit-io commented on GitHub (Jan 23, 2023):

Lol whoops, good catch. Thanks for finding the exact location in the codebase and suggesting a solution! Any chance you want to submit a pull request for it? :D

<!-- gh-comment-id:1399853599 --> @initialcommit-io commented on GitHub (Jan 23, 2023): Lol whoops, good catch. Thanks for finding the exact location in the codebase and suggesting a solution! Any chance you want to submit a pull request for it? :D
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/git-sim#2
No description provided.